#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin >> n;

  vector<int> x(n), y(n);
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
  }

  long long total_distance = 0;

  // 计算 x 坐标的距离之和
  sort(x.begin(), x.end());
  for (int i = 0; i < n; i++) {
    total_distance += (long long)x[i] * (2LL * i - n + 1);
  }

  // 计算 y 坐标的距离之和
  sort(y.begin(), y.end());
  for (int i = 0; i < n; i++) {
    total_distance += (long long)y[i] * (2LL * i - n + 1);
  }

  cout << total_distance << endl;

  return 0;
}
